<script setup>
import { defineProps, defineEmits, ref } from 'vue'
// 父传子
const props = defineProps({
  data: Object
})
const data = props.data
// 子传父
const emits = defineEmits(['clickFather'])
function clickSon(component) {
  emits('clickFather', component)
}
</script>

<template>
  <div class="tab">
    <i class="iconfont">&#xe677;</i>
    全部教程
  </div>
  <div class="sidebar-box">
    <div class="design" v-for="item in data" :key="item.index">
      <div class="navto-nav">
        <i class="iconfont">&#xe63e;</i>&nbsp;
        <span @click="clickSon(item.component)">{{ item.name }}</span>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.tab {
  padding-left: 4px;
  font-weight: bold;
  font-size: 1.2em;
  line-height: 2.6em;
  color: #64854c;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .15);
  border: 1px solid rgba(0, 0, 0, .1);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background-clip: padding-box;
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, .05) -17%, rgb(171 83 83 / 5%) 117%);
}

.sidebar-box {
  margin: 0 0 20px 0;
  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);

  .design:nth-child(2n+1) {
    background-color: #fbfbfb;
  }

  .design {
    padding: 4px;
    font-size: 1.2em;
    overflow: hidden;

    .navto-nav {
      cursor: pointer;
      margin: 8px 2px;
    }
  }
}
</style>
